<style>
    .primeng-datatable-container .ui-table table tbody {
        border: 1px solid #c8c8c8 !important;
    }
</style>
<div [@routerTransition]>
    <div class="m-subheader">
        <div class="d-flex align-items-center">
            <div class="mr-auto col-auto">
                <h3 class="m-subheader__title m-subheader__title--separator">
                    <span>工时报表</span>
                </h3>
                <span class="m-section__sub">
                    工时报表的文本头信息
                </span>
            </div>
            <div class="col text-right mt-3 mt-md-0">
                <div class="btn-group dropdown" dropdown container="body">
                    <button
                        dropdownToggle
                        class="btn btn-outline-success dropdown-toggle"
                        style="margin-right: 10px;"
                    >
                        <i class="fa fa-file-excel-o"></i>
                        Excel操作
                    </button>
                    <div class="dropdown-menu" *dropdownMenu>
                        <!-- <excel-import [showIcon]="false" [onlyLink]="true" [btnColor]="'success'"
                                [btnText]="'导入(按导出模板)'" (onUpload)="uploadExcel($event)"></excel-import>
                            <div class="dropdown-divider"></div> -->
                        <a
                            class="dropdown-item"
                            href="javascript:;"
                            (click)="exportToExcel()"
                            >导出所有数据</a
                        >
                    </div>
                </div>
            </div>
        </div>
        
    </div>

    <div class="m-content">
        <div class="m-portlet m-portlet--mobile">
            <div class="m-portlet__body">
                <div class="row align-items-center" style="padding: 0 14px;">
                    <!--<Primeng-TurboTable-Start>-->
                    <div
                        class="primeng-datatable-container myTable"
                        [busyIf]="primengTableHelper.isLoading"
                    >
                        <p-tabView (onChange)="onTabChange($event)">
                            <p-tabPanel header="班组工时" [selected]="true">
                                <div class="col-xl-12">
                                    <div
                                        class="form-group m-form__group align-items-center"
                                    >
                                        <div
                                            class="input-group myselect"
                                            style="width: 45%;"
                                        >
                                            <p-dropdown
                                                [options]="teamGroups"
                                                name="teamGroups"
                                                [(ngModel)]="orgid"
                                                placeholder="选择班组"
                                                optionLabel="displayText"
                                            ></p-dropdown>
                                            <span
                                                style="
                                                    line-height: 36px;
                                                    margin-left: 20px;
                                                "
                                                >选择时间：</span
                                            >
                                            <date-range-picker
                                            id="StartEndRange"
                                            [(startDate)]="startbDate"
                                            [(endDate)]="endbDate"
                                          ></date-range-picker>
                                            <span class="input-group-btn">
                                                <button
                                                    (click)="getBWorking()"
                                                    class="btn btn-primary"
                                                    type="submit"
                                                >
                                                    搜索
                                                </button>
                                            </span>
                                            <span
                                                class="input-group-btn"
                                                style="margin-left: 10px;"
                                            >
                                                <button
                                                    (click)="cleanB()"
                                                    class="btn btn-metal"
                                                    type="submit"
                                                >
                                                    清空
                                                </button>
                                            </span>
                                            <span
                                                class="input-group-btn"
                                                style="margin-left: 10px;"
                                            >
                                                <button
                                                    (click)="BanDetailToExcel()"
                                                    class="btn btn-success"
                                                    type="button"
                                                >
                                                    导出班组详细工时
                                                </button>
                                            </span>
                                        </div>
                                        
                                    </div>
                                </div>
                                <div
                                    class="row align-items-center"
                                    style="margin: 0 5px;"
                                >
                                    <div
                                        class="primeng-datatable-container"
                                        [busyIf]="primengTableHelper.isLoading"
                                    >
                                        <p-table
                                            #dataTable
                                            [value]="primengTableHelper.records"
                                            rows="{{
                                                primengTableHelper.defaultRecordsCountPerPage
                                            }}"
                                            [paginator]="false"
                                            emptyMessage="没有数据"
                                            scrollable="true"
                                            ScrollWidth="100%"
                                            responsive="primengTableHelper.isResponsive"
                                            resizableColumns="primengTableHelper.resizableColumns"
                                            dataKey="taskCode"
                                        >
                                            <ng-template pTemplate="header">
                                                <tr>
                                                    <th style="width: 100px;">
                                                        姓名
                                                    </th>
                                                    <th style="width: 150px;">
                                                        所属班组
                                                    </th>
                                                    <th style="width: 150px;">
                                                        工时
                                                    </th>
                                                </tr>
                                            </ng-template>
                                            <ng-template
                                                pTemplate="body"
                                                let-record="$implicit"
                                            >
                                                <tr style="height: 44px;">
                                                    <td style="width: 100px;">
                                                        {{ record.userName }}
                                                    </td>
                                                    <td style="width: 150px;">
                                                        {{ record.orgName }}
                                                    </td>
                                                    <td style="width: 150px;">
                                                        {{ record.workingTime }}
                                                    </td>
                                                </tr>
                                            </ng-template>
                                        </p-table>
                                        <div
                                            style="
                                                margin-top: 20px;
                                                font-weight: bold;
                                            "
                                        >
                                            {{ '合计工时:' + sumworking }}
                                        </div>
                                        <div class="primeng-paging-container">
                                            <p-paginator
                                                rows="{{
                                                    primengTableHelper.defaultRecordsCountPerPage
                                                }}"
                                                #paginator
                                                (onPageChange)="
                                                    getBWorking($event)
                                                "
                                                [totalRecords]="
                                                    primengTableHelper.totalRecordsCount
                                                "
                                                [rowsPerPageOptions]="
                                                    primengTableHelper.predefinedRecordsCountPerPage
                                                "
                                            >
                                            </p-paginator>
                                            <span class="total-records-count">
                                                {{
                                                    '总计:' +
                                                        primengTableHelper.totalRecordsCount
                                                }}
                                            </span>
                                        </div>
                                    </div>
                                </div>
                            </p-tabPanel>
                            <p-tabPanel header="个人工时">
                                <div class="col-xl-12">
                                    <div
                                        class="form-group m-form__group align-items-center"
                                    >
                                        <div
                                            class="input-group myselect"
                                            style="width: 80%;"
                                        >
                                            <p-dropdown
                                                [options]="users"
                                                [(ngModel)]="userName"
                                                [style]="{ width: '100%' }"
                                                optionLabel="name"
                                            ></p-dropdown>
                                            <span
                                                style="
                                                    line-height: 36px;
                                                    margin-left: 20px;
                                                "
                                                >选择时间：</span
                                            >
                                            <date-range-picker
                                            id="StartEndRange"
                                            [(startDate)]="startuDate"
                                            [(endDate)]="enduDate"
                                          ></date-range-picker>
                                            <input
                                                [(ngModel)]="filterText"
                                                name="filterText"
                                                autoFocus
                                                class="form-control m-input"
                                                [placeholder]="
                                                    l('SearchWithThreeDot')
                                                "
                                                style="
                                                    width: 40%;
                                                    margin-left: 20px;
                                                "
                                                type="text"
                                            />
                                            <span class="input-group-btn">
                                                <button
                                                    (click)="getUWorking()"
                                                    class="btn btn-primary"
                                                    type="submit"
                                                >
                                                    搜索
                                                </button>
                                            </span>
                                            <span
                                                class="input-group-btn"
                                                style="margin-left: 10px;"
                                            >
                                                <button
                                                    (click)="cleanU()"
                                                    class="btn btn-metal"
                                                    type="submit"
                                                >
                                                    清空
                                                </button>
                                            </span>
                                        </div>
                                    </div>
                                </div>
                                <div style="margin: 15px; font-weight: bold;">
                                    <span>
                                        {{
                                            '姓名:   ' +
                                                userWorkingTime.userName
                                        }}
                                    </span>
                                    <span style="margin-left: 20px;">
                                        {{
                                            '所属班组:   ' +
                                                userWorkingTime.orgDisplayName
                                        }}
                                    </span>
                                </div>
                                <p-table
                                    [value]="
                                        userWorkingTime.getUserWorkingTimeDetail
                                    "
                                    rows="{{ 10 }}"
                                    [paginator]="true"
                                    emptyMessage="没有数据"
                                    scrollable="true"
                                    ScrollWidth="100%"
                                    responsive="primengTableHelper.isResponsive"
                                    resizableColumns="primengTableHelper.resizableColumns"
                                    dataKey="taskCode"
                                >
                                    <ng-template pTemplate="header">
                                        <tr>
                                            <th style="width: 100px;">
                                                任务号
                                            </th>
                                            <th style="width: 150px;">
                                                任务名称
                                            </th>
                                            <th style="width: 150px;">
                                                图号
                                            </th>
                                            <th style="width: 100px;">
                                                投产数量
                                            </th>
                                            <th style="width: 150px;">
                                                主制班组
                                            </th>
                                            <th style="width: 150px;">
                                                质控卡
                                            </th>
                                            <th style="width: 150px;">
                                                工序名称
                                            </th>
                                            <th style="width: 100px;">
                                                工序工时
                                            </th>
                                            <th style="width: 100px;">
                                                个人工时
                                            </th>
                                            <th style="width: 100px;">
                                                    记录时间
                                                </th>
                                        </tr>
                                    </ng-template>
                                    <ng-template
                                        pTemplate="body"
                                        let-record="$implicit"
                                    >
                                        <tr style="height: 44px;">
                                            <td style="width: 100px;">
                                                {{ record.taskCode }}
                                            </td>
                                            <td style="width: 150px;">
                                                {{ record.taskName }}
                                            </td>
                                            <td style="width: 150px;">
                                                {{ record.drawNum }}
                                            </td>
                                            <td style="width: 100px;">
                                                {{ record.amount }}
                                            </td>
                                            <td style="width: 150px;">
                                                {{ record.orgName }}
                                            </td>
                                            <td style="width: 150px;">
                                                {{ record.zhiKongKaCode }}
                                            </td>
                                            <td style="width: 150px;">
                                                {{ record.nodeName }}
                                            </td>
                                            <td style="width: 100px;">
                                                {{
                                                    record.totalProcWorkingTime
                                                }}
                                            </td>
                                            <td style="width: 100px;">
                                                {{ record.personWorkingTime }}
                                            </td>
                                            <td style="width: 100px;">
                                                    {{
                                                        record.createTime
                                                        | momentFormat: 'YYYY-MM-DD'
                                                        }}
                                                </td>
                                        </tr>
                                    </ng-template>
                                </p-table>
                                <div style="margin: 15px 0; font-weight: bold;">
                                    {{ '合计工时:' + userWorkingTime.sumTime }}
                                </div>
                                <div style="margin: 15px 0; font-weight: bold;">
                                    {{ '合计:' + userWorkCount }}条
                                </div>
                            </p-tabPanel>
                        </p-tabView>
                    </div>
                    <!--<Primeng-TurboTable-End>-->
                </div>
            </div>
        </div>
    </div>
</div>
